﻿using System;

using SharedGenomics.Core;

namespace SharedGenomics.Domain.Builders
{
    /// <summary>
    /// Builder for instances of type T
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public interface IBuilder<T>
    {
        /// <summary>
        /// Creates an instance of T
        /// </summary>
        /// <returns>An instance of T defined by the state of the builder</returns>
        /// <throw>A <see cref="BuilderStateException"/> if the builder is not in a valid state</throw>
        T Build();

        /// <summary>
        /// Returns a collection of validation errors for the current state of the builder. Any validation errors refer to any instances of T that would be created if the 
        /// builder tried to build an object given its current state. Property names should therefore be valid properties on T.
        /// </summary>
        /// <returns>A <see cref="PropertyValidationErrorCollection"/> containing any errors for the state of the builder</returns>
        PropertyValidationErrorCollection Validate();
    }
}
